/*
package com.wb.utils

import okhttp3.*
import java.util.concurrent.TimeUnit

*/
/**
 * 网络请求工具类
 * @author 祁雪
 *//*

class Http3Util {

    companion object {

        var httpClient = OkHttpClient().newBuilder().connectTimeout(30, TimeUnit.SECONDS)
            .readTimeout(30, TimeUnit.SECONDS)
            .writeTimeout(30, TimeUnit.SECONDS)
            .build();

        */
/**
 * get 提交
 *//*

        fun getSend(url: String, params: Map<String, String>?): String? {

            var urlx = ""

            if (!params.isNullOrEmpty()) {
                var string = StringBuffer();

                params.forEach { (k, v) ->
                    if (!v.isNullOrEmpty()) {
                        string.append(k + "=" + v + "&")
                    }
                }

                urlx = url + "?" + string
            } else {
                urlx = url
            }

            println(urlx)

            val request = Request.Builder().url(urlx).get().build();

            var response = httpClient.newCall(request).execute();

            var responseBody = response.body()
            val msg = responseBody?.string()

            responseBody?.close()
            response.close()

            return msg;
        }

        */
/**
 * post 提交
 *//*

        fun postSend(url: String, params: Map<String, String>?): String? {

            println(url)

            var formBody = FormBody.Builder();

            params?.forEach { (k, v) ->
                if (!v.isNullOrEmpty()) {
                    formBody.add(k, v);
                }
            }

            var request = Request.Builder().url(url).post(formBody.build()).build();

            var response = httpClient.newCall(request).execute();

            var msg = response?.body()?.string()

            response.close()
            return msg;
        }

        */
/**
 * get 提交
 *//*

        fun getSendR(
            url: String,
            params: Map<String, String>?,
            headersMap: Map<String, String>?
        ): Response {

            var urlx = ""

            if (!params.isNullOrEmpty()) {
                val string = StringBuffer();

                params.forEach { (k, v) ->
                    if (!v.isNullOrEmpty()) {
                        string.append(k + "=" + v + "&")
                    }
                }

                urlx = url + "?" + string
            } else {
                urlx = url
            }

            val headers = Headers.Builder()

            headersMap?.forEach { (k, v) ->
                if (!v.isNullOrEmpty()) {
                    headers.add(k, v)
                }
            }
            println(urlx)

            val request = Request.Builder().url(urlx).headers(headers.build()).get().build();

            val response = httpClient.newCall(request).execute();

            return response;
        }

        */
/**
 * post 提交
 *//*

        fun postSendR(
            url: String,
            params: Map<String, String>?,
            headersMap: Map<String, String>?
        ): Response {

            println(url)

            val formBody = FormBody.Builder();

            params?.forEach { (k, v) ->
                if (!v.isNullOrEmpty()) {
                    formBody.add(k, v);
                }
            }

            val headers = Headers.Builder()

            headersMap?.forEach { (k, v) ->
                if (!v.isNullOrEmpty()) {
                    headers.add(k, v)
                }
            }

            val request = Request.Builder().url(url).headers(headers.build()).post(formBody.build()).build();

            val response = httpClient.newCall(request).execute();

            return response;
        }
    }

}

fun main() {
    println(
        Http3Util.getSend(
            "https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.9.0", mapOf(
                "a" to "A",
                "b" to "B"
            )
        )
    )
}*/
